package java7.addSuppressed;

import java.io.FileInputStream;
import java.io.IOException;

public class Basic {
	public static void main(String[] args) {
	}
	
	public void read(String filename) throws IOException {
        FileInputStream input = null;
        IOException readException = null;
        try {
            input = new FileInputStream(filename);
        } catch (IOException ex) {
            readException = ex;
        } finally {
            if(input != null){
                try {
                    input.close();
                } catch (IOException ex2) {
                    if(readException != null){
                        readException.addSuppressed(ex2);    //注意这里
                    }else{
                        readException = ex2;
                    }
                }
            }
            if(readException != null){
                throw readException;
            }
        }
    }
}
